package com.kuyun.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.kuyun.entity.User1;
import com.kuyun.service.PersonalCentreService;

@Controller
@RequestMapping("/personal")
public class PersonalCentreController {
	
	@Autowired
	private PersonalCentreService personalCentreService;
	
	@RequestMapping(value="/selectUser")
	@ResponseBody
	public Object selectUser(String userId) {
		System.out.println("544545454554454545");
		Object a = personalCentreService.selectUser(userId);
		return a;
	}
	
	@RequestMapping(value="/selectUser1")
	public String selectUser1(ModelMap map) {
		Object a = personalCentreService.selectUser("1");
		System.out.println("aduygfuygfygfyag");
		map.put("select", a);
		return "selectUser";
	}
	
	@RequestMapping(value="/updateUser")
	@ResponseBody
	public Object updateUser(User1 user1){
		System.out.println("=========");
		System.out.println("666644445821235212");
		int a=personalCentreService.updateUser(user1);
		if(a>0){
			return 1;
		}else{
			return 0;
		}	
	}
	
	@RequestMapping(value="/selectUserName")
	@ResponseBody
	public String selectUserName(String userId){
		String userName=personalCentreService.selectUserName(userId);
		return userName;	
	}
	

}
